# Contributor: Miles Alan <m@milesalan.com>
# Maintainer: Miles Alan <m@milesalan.com>
pkgname=mobroute
pkgver=0.8.0
pkgrel=0
pkgdesc="General-Purpose FOSS Public Transportation (GTFS) Router CLI"
options="net"
url="https://sr.ht/~mil/mobroute"
license="GPLv3.0-or-later"
arch="all !x86" # x86 fails tests due to sqlite driver bug: https://github.com/mattn/go-sqlite3/issues/1241
makedepends="go sqlite-dev"
depends="tzdata"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~mil/mobroute/archive/v$pkgver.tar.gz
"
builddir="$srcdir/mobroute-v$pkgver"
subpackages="$pkgname-doc"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	./build.sh build
}

check() {
	./build.sh test
}

package() {
	install -Dm0755 $pkgname -t "$pkgdir"/usr/bin
	cd doc
	find . -type f -exec install -Dm 644 {} "$pkgdir/usr/share/doc/$pkgname/{}" \;
}

sha512sums="
0f66f7ce93c47c9da09a3e0a9e94ef1985bca021b3d0b2fecdedb9930e9ebdebd6a2320980f7356c70a4edd090932181b9fd52492afd2b7e5f613f80b56fb582  mobroute-0.8.0.tar.gz
"
